package day15.string;

import org.junit.Test;

import java.util.Arrays;

/**
 * @Auther:小陈的Java
 */
public class StringDemo1 {
    @Test
    public void stringTest1(){
        //String[] str = {"张三","李四","王五"};
        String[] str = {"zhangsan","lisi","wangwu"};
        Arrays.sort(str);
        System.out.println(Arrays.toString(str));
    }
    @Test
    public void stringTest2() throws Exception{
        String  str = new String();//等同“ ”;
        byte[] bb = {97,98,99};
         String str1 = new String(bb);
        System.out.println(str1);
        String str2 = new String(bb,"gbk");
        System.out.println(str2);
        String str3 = new String(bb,0,1);
        System.out.println(str3);
        String str4 = new String(bb,0,1,"utf-8");
        System.out.println(str4);


        char[] cc = {'我','爱','你','中','国'};
        String str5 = new String(cc);
        System.out.println(str5);
        String str6 = new String(cc,0,3);
        System.out.println(str6);

    }
}
